package org.raymond.iworks.study.basic.designpattern.memento.game;

import lombok.Getter;
import lombok.Setter;

/**
 * @author raymond
 * @version V1.0
 * @Description: TODO
 */
@Getter
@Setter
public class GameRole {
    private int vit;
    private int def;
    // 根据当前状态创建memento
    public Memento createMemento(){
        return new Memento(vit, def);
    }
    public void recoverGameRole(Memento memento){
        this.vit = memento.getVit();
        this.def = memento.getDef();
    }
    public void display(){
        System.out.println("游戏角色当前的攻击力:"+this.vit+" 防御力:"+this.def);
    }
}
